package com.service.login.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dao.login.LoginDao;
import com.entity.User;
import com.service.login.LoginService;
import com.util.dao.BasicDao;

@Service("loginService")
public class LoginServiceImpl implements LoginService {
	
	@Autowired
	private LoginDao loginDao;
	
	@Autowired
	private BasicDao basicDao;

	public List<User> getUserByUsername(String username) throws Exception {
		List<User> users=null;
		try{
			users=loginDao.getUserByUsername(username);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return users;
	}

	public void saveUser(User user) throws Exception {
		try{
			basicDao.insert(user);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void updateUser(User user) throws Exception {
		try{
			loginDao.updateUser(user);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

}
